Bitmap graphics compression for image data

ABSTRACT

The invention relates to the provision of a graphic compression method for pixel data for a display screen and particularly a display screen provided as part of a mobile device. The method includes the splitting of pixels data for the display into quadratic groups of pixels typically 2×2 pixels, and by encoding representing the same with respect to a number of color templates, with a reduced number of bits.

[0001] The invention to which this application relates is to thecompression of data and in particular image data.

[0002] With the increasing use of mobile devices which may have alimited memory capacity and/or network bandwidth for receiving data, thecompression of data is becoming increasingly important so that the samecan be transmitted and received in a usable format.

[0003] A common way of providing indications or options or otherinformation to a user of a device is to provide graphic symbols inaddition to text or alternatively to text. However, the volume of datarequired for graphics can be extremely large, for example, a bitmapimage can consist of many pixels and each pixel has an associated colourand in modern applications the colours are typically defined from apalette of roughly 16 million available colours. If a bitmap image is300 pixels wide and 300 pixels high this means that there are 90,000pixels, each of which may require up to four bytes of colour informationwhich can give an image which has 360,000 bytes or 352 KB in size.

[0004] Some prior art which is already known is disclosed in U.S. Pat.Nos. 6,091,850 and 5,625,759 which are largely concerned with solvingthe problem of optimal palette selection. The compression is aside-effect of this process. They do also specify compressiontechniques, but both patents attempt to compress a bitmap graphic imageby analysing both the shapes and colours in that image and this islargely true of any graphics compression method. Furthermore bothpatents suggest ways of improving the compression ratio using techniquessuch as run-length encoding and observe that small groups of pixels canhave their colour depth reduced to one or two colours in normal imageswithout the results being too detrimental. The present invention aims toimprove on these methods by providing a graphics compression methodwhich, when used, can reduce image sizes by a significant amount.

[0005] In a first aspect of the invention there is provided a method forthe compression or reduction of data relating to a graphic image forgeneration on a display screen said method comprising splitting thepixels required for the graphical image into quadratic groups of pixelsand then, with reference to each group of four pixels, representing thesame with reference to one of one or two colour templates, and thenallocating appropriate identification for the selected one of thetemplates in an encoded format, for the group of four pixels.

[0006] In a preferred embodiment reference is made to eight one or twocolour templates one of which is selected and for which the generationof the bits to represent the quadratic group is preferred. The group ispreferably a square group of four pixels.

[0007] Typically, for each group of four pixels, the method analyses thesimilarity between each colour to the other three colours in the group.This therefore means that there are six colour comparisons required tobe undertaken for each group of four pixels.

[0008] Typically the method distinguishes between groups of a uniformcolour and groups with more than one colour.

[0009] Thus in this invention it is possible in small pixel groups of2×2 pixels, rather than conventional 4×4 groups, to describe virtuallyall combinations of pixels in a picture using just two colours withoutany noticeable loss of colour by the human eye.

[0010] When the comparison has been obtained and the six resultsobtained these can be compared against a threshold value whichdetermines which of the templates from the eight colour template is bestsuited. When determined for each of the six comparisons, the appropriatetemplate can be represented by three bits.

[0011] In a further feature of the invention any two colour group of 2×2pixels can be represented using one of only seven colour templates andso, in turn can be encoded in three bits. Typically the eighth colourtemplate is used for one or single colour groups of pixels.

[0012] In one embodiment a further bit is required to indicate thepolarity of the template.

[0013] As the method works on smaller groups of pixels than conventionalmethods it does not require an anti-aliasing mode. This saves on therequired flags overhead, at the expense of storing more templates. Thatis no loss as the provision of four, three bit templates still requires25% less bit processing than one 16 bit bitmap which is conventionallyused by analysing 4×4 pixel blocks.

[0014] Thus, with the method outlined, it is possible to compress datarelated to an image by around 50% and this can be improved significantlyfurther by reducing the colour depth of the palette, by computing anoptimal palette for the compressed image or by employing the run-lengthencoding or a similar scheme on the colours for each template.

[0015] A specific embodiment of the invention is now described withreference to the accompanying figures wherein:

[0016] FIGS. 1A-H illustrate the eight colour templates which are usedin one embodiment of the method, and

[0017]FIG. 2 illustrates a pixel group of four pixels as used inaccordance with the invention.

[0018] The method of the invention provides for the measurement of howclose each colour is to the others. This can be done using sixapplications of a trigonometric function (based on a 3D version ofPythagoras's function for calculating the length of the hypotenuse of aright-angled triangle from the opposite and adjacent side lengths):

d=(RED_(a)−RED_(b))²+(GRN_(a)−GRN_(b))²+(BLU_(a)−BLU_(b))²

[0019] This function computes d, the square of the distance between thetwo colours (a and b) given the red, green and blue components of theircolour (assuming an RGB colour model).

[0020] The distance between each colour can be obtained by calculatingthe square-root of d, but this is an expensive computation not requiredfor the algorithm, so it is not performed, in this embodiment. Also,each component is preferably weighted to match the relative sensitivityof the Human eye to that component.

[0021] For other linear colour models (eg: CMYK), the function aboverequires a valve for the number of components changing (eg: make itfour-dimensional for CMYK).

[0022] The six comparisons required in accordance with the invention andwith reference to the group of pixels in accordance with FIG. 2 whichshows a group of four pixels, 1, 2, 3, 4.

[0023] 1. Compare the colour of pixel 1 with the colour of pixel 2;

[0024] 2. Compare the colour of pixel 1 with the colour of pixel 3;

[0025] 3. Compare the colour of pixel 1 with the colour of pixel 4;

[0026] 4. Compare the colour of pixel 2 with the colour of pixel 3;

[0027] 5. Compare the colour of pixel 2 with the colour of pixel 4;

[0028] 6. Compare the colour of pixel 3 with the colour of pixel 4.

[0029] With the results of these comparisons, it is possible to tell howclose the colour of each pixel in the group is to every other pixel'scolour.

[0030] With this information, the six d values are compared against athreshold value, t. This threshold defines what value of d is consideredto be ‘close’, thus:

[0031] d₁<=t;

[0032] d₂<=t;

[0033] d₃<=t;

[0034] d₄<=t;

[0035] d₅<=t;

[0036] d₆<=t

[0037] The result for each test can be considered as a single bit; setif TRUE and clear if FALSE. All six bits can be combined to give a sixbit field (ie: a number in the range 0 to 63).

[0038] For each value of the six bit field, we ‘know’ which templatefits best, if any. As an example, the value 0b000000 indicates that allpixel colours are further from each other than the threshold value. Notemplate fits well with this combination.

[0039] Value 0b100001 indicates that the colours of pixels 1 and 2 areat least as close as the threshold, as are the colours of pixels 3 and4. The colours of pixels 1 and 2 are further than the threshold fromthose of pixels 3 and 4. This indicates that template 3 (two horizontalbands) is a good fit.

[0040] Value 0b110000 is ambiguous; it could be template 8, but thecolours of pixels 2 and 3 are further from each other than thethreshold.

[0041] For every possible value (0 to 63) of the bit field, we candecide to either select a template for the pixels based on what is knownabout the value, or we can increase the threshold value by some amount(ie: a small amount when the template is slightly ambiguous or a largeamount if no template fits) and repeat the process from the six d valuecomparisons to construct a new bit field. Eventually, a template willfit, but the loss of information increases with t.

[0042] When one of the templates 1A-1H is chosen, the colour(s) for itmay be derived by averaging the pixel colour for each subgroup, ‘1’ or‘2’ (shaded), possibly including error diffusion. The bits required canthen be allocated and encoded and so the reduction in data is achieved.Template 1A is used for a single or one colour group of pixels withtemplates 1B-H used and selected as appropriate for 2 colour groups ofpixels.

[0043] To further illustrate the advantages of the invention of amathematical comparison with the method of U.S. Pat. No. 5,046,119 isnow described.

[0044] Given a simple example a (noisy) image of 16 by 16 pixels, givinga total of 256 pixels is used.

[0045] The method in U.S. Pat. No. 5,046,119 would require 16*64=1024bits to encode the image.

[0046] The invention of the method requires 64*(2+16)−1152 bits for thesame image (assuming, that the colours are encoded into eight bits).This is a cost of an extra 128 bits (12.5%) to encode four times thecolour information.

[0047] However, if the method in patent U.S. Pat. No. 5,046,119 isapplied to blocks of 2 by 2 pixels, without anti-aliasing (it is of nouse on such small blocks), to give a more similar comparative resolutionto that achieve in the invention, it would require 64*(32+4)=2304 bits.

[0048] This is 1152 bits (50%) more than required by the method of thecurrent invention.

[0049] Even if the pixel depth of the colours store in the prior artencoding scheme were reduced to 8 bits per colour (i.e. the proposedscheme in the US patent is modified), the image would require64*(2+4+16)=1408 bits.

[0050] This is still 256 bits (18%) more than the method of theinvention.

[0051] Note: (noisy) in this case is defined as each pixel in the sourceimage having a wide and random distribution in colour space whencompared against other pixels in the image.

[0052] It should be appreciated that the method of the embodiment asherein described is provided for illustrative purposes only andtherefore should not be interpreted as the only method which can befollowed in accordance with the invention.

[0053] Thus the conventional methods are inherently more complexcomputationally than that of the current invention. This is an importantconsideration on most modern devices, where decompression speed is a keyfactor in the acceptance of a compression standard.

[0054] Furthermore, the method of the current invention will producebetter quality output; as the smaller pixel group size allows finerdetail to be preserved in the output image. It will also avoid theblurring effect inherent in anti-aliasing.

1. A method for the compression or reduction of data relating to a graphic image for generation on a display screen, said method comprising splitting the pixels required for the graphical image into quadratic groups of pixels and then, with reference to each group of four pixels, representing the same with reference to one of a number of one or two colour templates, and then allocating appropriate identification for the selected one of the templates in an encoded format, for the group of four pixels.
 2. A method according to claim 1 characterised in that reference is made to eight one or two colour templates, one of which is selected, for the generation of the bits to represent the quadratic group.
 3. A method according to claim 1 characterised in that for each group of four pixels, the method analyses and compares the similarity between the colour of each pixel to the colour of the other three pixels in the group.
 4. A method according to claim 1 characterised in that when the comparison has been obtained for each of the pixels in the group these are compared against a threshold value which determines which of the templates from the eight colour template is best suited.
 5. A method according to claim 4 characterised in that when the best suited template is determined which best matches each of the colour comparisons, the appropriate template can be represented by three bits.
 6. A method according to claim 1 characterised in that each quadratic group is a square group of four pixels. 